-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Adds mobile menu using AMP #120
Conversation
…mobile menu; add new mobile menu styles to the Sass build.
53df7f6
to
e66f0a2
Compare
I created a second example PR in #129 that shows the |
|
||
if ( 'primary-menu' === $args->theme_location ) : | ||
|
||
$nav_menu .= '<div class="main-menu-more">'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This div
is causing a validation error here. The AMP plugin is reporting the element as being invalid here because it is violating this constraint in the amp-sidebar > nav
tag spec:
child_tags: {
mandatory_num_child_tags: 1
child_tag_name_oneof: "OL"
child_tag_name_oneof: "UL"
}
Nevertheless, even though the AMP plugin is reporting it as a validation error, it is not removing it. Also, the markup is not causing validation errors in the AMP Validator. So I'm confused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think what you have is correct here, and there is a bug with the AMP plugin. Namely, because the parent nav
does not have a toolbar
attribute, this constraint should not be applying.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've opened a fix: ampproject/amp-wp#2926
Thanks for catching and reporting that, @westonruter! A cleaned up version of the AMP menu was added in #158, so I'm going to close this PR. |
All Submissions:
Changes proposed in this Pull Request:
This PR is a WIP of adding a mobile-style menu using AMP functionality.
I wanted to share it to get some feedback on the approach -- it does duplicate quite a bit of code, and essentially hides the dupes when not in use (so they're ignored by screen readers, but still there).
AMP does have an approach (toolbar-target) where you can have a
nav
in the sidebar automatically copied into a specific ID at a certain breakpoint, which would reduce the duplication. However:toolbar-target
approach would get confusing with the complexity already in the header (it will involve empty divs).toolbar-target
approach (a menu displaying in a very small space with scrollbars); but I didn't dig to far into how much work it would be to override.I'm not against trying the
toolbar-target
approach, but I didn't want to get too far into the weeds before getting a second opinion.See #96.
How to test the changes in this Pull Request:
npm run build
.Other information: